package com.guoxin.chapter4.reentractlock.reentrantlocktest;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class Service {
	private Lock lock = new ReentrantLock();
	
	public void testMethod(){
		try {
			lock.lock();
			for (int i = 0; i < 5; i++) {
				System.out.println("ThreadName=" + Thread.currentThread().getName() + (" " + (i + 1)));
			} 
		} finally {
			lock.unlock();
		}
	}
}
